;;; early-init.el --- Emacs 27+ pre-initialisation config

;;; Commentary:

;; Emacs 27+ loads this file before (normally) calling
;; `package-initialize'.  We use this file to suppress that automatic
;; behaviour so that startup is consistent across Emacs versions.

;;; Code:

(setq package-enable-at-startup nil)

(setq load-prefer-newer noninteractive)

(defvar my-computer-has-smaller-memory-p nil
  "Compiling and install too packages could cost too much memory.")

;; @see https://www.reddit.com/r/emacs/comments/ofhket/further_boost_start_up_time_with_a_simple_tweak/
;; 10% speed up of startup for my configuration
(unless my-computer-has-smaller-memory-p
  (setq gc-cons-percentage 0.6)
  (setq gc-cons-threshold most-positive-fixnum))

;;(setq-default inhibit-redisplay t
;;	      inhibit-message t)
;;(add-hook 'window-setup-hook
;;	  (lambda ()
;;	    (setq-default inhibit-redisplay nil
;;			  inhibit-message nil)
;;	    (redisplay)))

;;(define-advice load-file (:override (file) silence)
;;  (load file nil 'nomessage))


;; So we can detect this having been loaded
(provide 'early-init)

;;; early-init.el ends here
